//封装

//类
class Student{
    //成员属性
    public String name;
    public int age;
    public static String classroom = "1班";

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public static String getClassroom(){
        return classroom;
    }

    //    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    public int getAge() {
//        return age;
//    }
//
//    public void setAge(int age) {
//        this.age = age;
//    }

    //成员方法
//    public void eat(){
//        System.out.println(this.name + "在吃饭");
//    }
//
//    public void sleep(){
//        System.out.println(this.name + "在睡觉");
//    }
//
//    public void show(){
//        System.out.println("姓名 " + this.name + " 年龄 " + this.age);
//    }
}

//类的使用者
public class Blog {
    public static void main(String[] args) {
        //实例化一个对象
        Student student = new Student("小罗",10);
        Student student1 = new Student("小泽",9);
        Student student2 = new Student("小美",12);
//        System.out.println(Student.classroom);
//        Student.classroom = "2班";
//        System.out.println(Student.classroom);

        //调用静态方法
        System.out.println(Student.getClassroom());


        //调用set get方法
//        student.setName("小罗");
//        student.setAge(10);
//        System.out.println(student.getName());
//        System.out.println(student.getAge());
//        student.eat();
//        student.sleep();
//        student.show();

    }
}
